package com.yq.admin01.controller;

import com.yq.admin01.emtity.Emp;
import com.yq.admin01.service.EmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Repository;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping("/emp")
public class EmpController {
    @Autowired
    EmpService empService;

    @GetMapping("/list")
    public String list(Model model) {
        List<Emp> list = empService.getAllEmps();
        model.addAttribute("emps", list);
        return "list";
    }
}
